---
layout: docs
page_title: 'nomad operator raft state command reference'
description: |
  The `nomad operator raft state` command displays Raft server state obtained by replaying Raft log entries persisted in the Nomad data directory.
---

# `nomad operator raft state` command reference

The `raft state` command is used to display the server state obtained by
replaying raft log entries persisted in the Nomad [data directory] in
JSON format.

This command requires file system permissions to access the data
directory on disk. The Nomad server locks access to the data
directory, so this command cannot be run on a data directory that is
being used by a running Nomad server.

~> **Warning:** This is a low-level debugging tool and not subject to
  Nomad's usual backward compatibility guarantees.

## Usage

```plaintext
nomad operator raft state [options] <path to data dir>
```

## Options

- `-last-index=<last_index>`: Set the last log index to be applied, to
  drop spurious log entries not properly committed. If the
  `last_index` option is zero or negative, it's treated as an offset
  from the last index seen in raft.

## Examples

The output of this command can be very large, so it's recommended that
you redirect the output to a file for later examination with other
tools.

```shell-session
$ sudo nomad operator raft state /var/nomad/data > ~/raft-state.json
$ jq . < ~/raft-state.json
```

[data directory]: /nomad/docs/configuration#data_dir
